﻿using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjectHelper;

namespace Dzzzr
{
    public class GameEntityInfo : IComparable<GameEntityInfo>
    {
      private int? entityID;

			private int? parentID;
			
			private int gameID;

			private int entityTypeID;

			private string name;

      private string entityTypeName;

			private int? gameRoleID;
      
			private string gameRoleName;
    	private bool visible;
    	
			private int orderNumber;

    	[DataMapping(null)]
			public int? EntityID
    	{
				get { return entityID; }
				set { entityID = value; }
    	}

			[DataMapping(null)]
			public int? ParentID
    	{
    		get { return parentID; }
    		set { parentID = value; }
    	}

			[DataMapping(-1)]
			public int GameID
    	{
    		get { return gameID; }
    		set { gameID = value; }
    	}

			[DataMapping(-1)]
			public int EntityTypeID
    	{
    		get { return entityTypeID; }
    		set { entityTypeID = value; }
    	}

    	[DataMapping("")]
			public string Name
    	{
    		get { return name; }
    		set { name = value; }
    	}

			[DataMapping("")]
			public string EntityTypeName
    	{
    		get { return entityTypeName; }
    		set { entityTypeName = value; }
    	}

			[DataMapping(null)]
			public int? GameRoleID
    	{
    		get { return gameRoleID; }
    		set { gameRoleID = value; }
    	}

			[DataMapping("")]
			public string GameRoleName
    	{
    		get { return gameRoleName; }
    		set { gameRoleName = value; }
    	}

			[DataMapping(true)]
			public bool Visible
    	{
    		get { return visible; }
    		set { visible = value; }
    	}

			[DataMapping(-1)]
			public int OrderNumber
    	{
    		get {	return orderNumber; }
				set { orderNumber = value; }
			}

    	public int CompareTo(GameEntityInfo other)
    	{
				if (other.OrderNumber == this.OrderNumber && other.ParentID == this.ParentID)
					return 0;
				if (other.ParentID == this.ParentID)
				{
					if (other.OrderNumber > this.OrderNumber)
					{
						return -1;
					}
					else
					{
						return 1;
					}					
				}
				else if (other.ParentID > this.ParentID)
				{
					return -1;
				}
				else
				{
					return 1;
				}

				
    	}
    }
}
